a bunch of this initialization is from the template and is really not necessary. Particularly all that thread stuff for example, and including the pthread.h header.