refactor commands.go into an object, will be easier for tests