Added a further condition for the get_location_heirarchy to realize that it had reachedth the root location