added modulo, which may need fixing if the tree ends up being different