improvement and refactoring