Fix a bunch of ordering issues