for done, works well, may need further test
modified hierarchy