TODO: - Cleanup and split the timer function