Fixed tests and tools to pass full test suite for replset and mongos
Refactored replset.js to prototype style