major refactoring in progress