added timer function