Refactor of timelapse_action.py