Tweak preload commands
Add profiling options, and various optimizations
Make the library platform-independent