Finished the sendCommand function