added timer logic