changed pthread_exit() to return, fixed many warnings