changed connect to support more options