improved mongodb integration