Revert "Revert "some code cleanup, added page numbers to page titles""

This reverts commit 9e349a2649177f6fad3ff313d7ade4e683b52fc6.
Fixed page numbers hopefully