added support for class hierarchies (sti and abstract-class based)