Also reduce API exposure and use standard library more - and fix bugs I previously introduces in mongo.