Added getConnection() and send() and added more error checking