Adeed code for timers. Not tested. Probably buggy