Added a couple of move-related functions.
Added namespaces.
Moved functions around, split some out.