refactoring - intermediate