update and refactoring