Change connect() to be promise-based