connect refactored