Modified identity function to work with joined inheritance tables.
Added regression tests