changed walk to pre-order
add a few utilities
some code for transforming stack to registers