added timer function. Somehow executes code twice. NEED FIX