lots of changes to refactor the way commands are passed