Fix prefix tree implementation bugs
Import some files from Blumer