add tests using a fake mongo and refactor to use synchronous methods where possible