More generic command handling