Assortment of fixes and cleanups
- fixed Xcode Analyze warnings,
- fixed a few leaks