implemented a sleep timer