refactored replset state to prototype