Working on implementing tree flattening behaviour