timer code cleanup