Massive refactor now about 50% done