Clean up internal command handling