functional timer, moved to external js file