More sophisticated command handling