issuing request on new thread. And dispatching calls to the delegate via the main thread.

Had to add some flags too. Also I reorganized the codebase slightly.