Refactored connection methods - moved them out to ConnectionUtils.java