Refactor command