Implemented connect as a Task