Async networking

Don't block the main thread making network calls. A patch for Issue #787.

This works as far as I can tell but I've not got far enough in my development to be sure. I think it's a good patch but I wouldn't merge just before a release...