udpated timer function