bloatload of changes to get most of the merge tests to actually pass