code reshuffle
Wip changes to support inheritance.