refactoring for update implementation