created .h files and cleanup of pthread calls