Connector code refactor