separated local and remote into threaded methods. added includes for thr...

...eading and added thread creation for both threads.