Cleanup logic added