Various bits of cleanup, should hopefully fix the build