Continued major refactor WIP.