Begin work on rewriting to use sql and layouts similar to mojibake-flat