Cleaned up code with help of std::map and boost::format again
Messed with pthread static linking (unsuccessfully).