refactoring (in progress)