attempt to make separate ORM module, still big mess