Moved the atom moving code into a library that will hopefully be portable in future versions.