refined command handling