organized import
added connection checking