added timer and clear function