added code for timer