Refactoring of method to prepare connection parameters