Added hierarchy checks and start of unit tests.