refactoring ref #3