added connect() and common code base