added hostname option, added per-thread key
Remove duplicate typedefs