Fixed segfaults due to negative integers from modulus function, and added connection functionality to client.