main.cpp refactor, added timelapse