Updated to use mongodb