Refactor first pass. Split files into roughly where they belong, now the fun begins of whipping this old codebase back into shape.