Rewrite of greedy stitcher, using sub-block open/closed simplifications and improved structure