cleanup timers on undeploy, also general improvement of resource cleanup code