Large refactor. Some more framework. Getting close to making tools.