brought the manager cleanup code into the callback function and removed window from setTimeout