begin major refactor