WIP - recompile draft doc, begin code refactor