some timer functions from internet