Lots of cleanup in preparation to merge back to master