added a timer and pause function