Lots of fixes and progress in the command system