Add preload hook support, and minor cleanups
Merge pull request #109 from ihnorton/preloadhook

Add preload hook support, and minor cleanups