changed connect script into object