Updated and integrated tree builder to use hierachical keys instead of
parent key searching