Clean up command handling