Re-organized command handling