modified code after a BIG change in models