Minor fixes and some cleanup