refactoring, optimization