updated to use mongoose