Hierarchy

This PR uses the class definition in #32 and closes #21 .