generic refactoring - 1st iteration