swithed to mongoose and did some refactoring