trees, update codes