changes in processMessages method, return NULL instead of pthread_exit(NULL)