Experimental rewrite

Added watertight folds, results are somewhat sane but a few rows get missed.