refactored timeline main loop