refactor timer php file