use reg expressions for detecting mime types, more defensive programming, ignore pdf generation warnings
try to be smarter about setting up the environment based on host
more TOC examples