added includes and -pthread