Refactored _cleanup