separated logic into a models folder and a db folder