refactoring, improvements