Add sendCommand() and convert existing methods to use it