A bunch of minor fixes and changes