added a type chain class to abstract out the iteration in different
directions also refactored out the methods in the abstract factory class
to make each part overridable