refactoring (work in progress)