Fix some compiler warnings
Add importString/loadString functions; fix some memory leaks; update to avoid deprecated APIs; tidy in a few places
Avoid compiler warning for deprecated API we can't readily replace