end of major refactor