Removed old code and tweaked timer functions to take a timer struct