Added the timer to sleep mode and some other fixes.