Removed a few small bugs, and added support for persistent client connection. It *does* need testing though! I also added error reporting.