accept hierarchy as a prameter.