Refactor command handling into the commands class, at least as far as we are able to up to this point.