Refactored Timer and Looping structure