Additions and improvement to ORM; generic models