Added exceptions, changed connect to handle checking of active connection and implemented checkTableExists