tidy up promise chaining
make Command.type an Enum
underscore suffix for private members