Refactor update method.