Segregate XEntities

Into code and includes, this should be a no-change transformation at
this point.
convert XEntity to struct

no-change transformation.

Tests pass.
Refactor ProcessEntities

Which was the point of making XEntity into a struct, so we have a single
function that does all the inclusions.

All tests pass.
cleanup from last commit

-Add a logger entry for code inserts.
-Hoist out "pos" that was recomputed at each loop.