Refactored connector logic.