Tweaking before break.
Partially refactored one. This is mostly invalid, and will need rebuilt from the 'refactor' directory.