Adding support for replica sets

Change-Id: I80e7e6aa539d8d83986d4a8349ae6c255539eeae