Refactorize update command.