add proper thrown Exceptions and connection checking