#11: Updated the text handling in the tree builder to more accurately work in before head mode.