Edit AllPages
Please read General/RefactoringImprovingTheDesignOfExistingCode by General/MartinFowler &al.
See also http://www.c2.com/cgi/wiki?General/WhatIsRefactoring.