Made cleanup smarter