Fixed problem with not including <limits>
Properly hooked up pthread support.