timer and clean up