Integrate some library functions

I vaguely remember looking at your commit and if I recall correctly assignment now performs a deep copy (and so it should, in general) rather than a shallow copy?  So I left in what I'd already written for efficiency.  Though since passing an argument to a function is implicitly an assignment to a local variable I would need to edit this to pass a pointer instead. Or I could just remove it, because running the automated tests isn't exactly a time critical piece of code.