extend and refactoring