Made copyLamVal iterative and fixed various memory issues so that all
operations return fresh copies of lamVals ie no more memory sharing. In
short: treat all arguments as immutable, and all functions return a
fresh copy of whatever they were modifying, leaving the original
untouched. The exception to this is rename_() which modifies a copy in
place to be less wasteful. I'll see if there is room for similar
optimizations in other places.