Use `callCommandMachine` and improve error handling.