refactored page numbering, moved around classes