Implement proper cleanup