Reverse order of command return values

Also fix some bugs found in the proccess of testing this.