refactoring work in progress