Added pthread fix and makefile cleanup.