Refactored page logic, added phase and phase length attr