Rewrote mongo_db_lib.js and api.js functions to improve efficiency. All tests passing