adding support for replica set and authentication