Added methods and tests to calculate hierarchy scores