Pthread method created. Still needs refactor.