refactors method to check connections and privatizes methods