Cleanup and a couple of misc fixes