Implemented a timer logic.