Reduce use of reflection, handle expandee and expanded tree

The previous commit made an intensive use of reflection, using
structural, etc. on envery call.

As it has been pointed out, the previous commit wouldn't work in
some cases. This problem has been addressed.