Remove old cruft, and fix up ordering columns used when writing out the join