major refactor in progress