major refactor WIP