Refactored to mongoose.