major refactor on how pages are controlled