Refactored to use Mongoose.