implemented environment copying
undo/redo functions stored in stacks now take environment as parameter
so that the stacks can be copied to new environment