Refactored the timer to use RT timer