massively improved gridfs stuff. Added flush command and write caching