use instanceof instead of is_a(), (should be faster), dead code removed
unit test for AbstractEntity added, code cleanup