Cleanup command code