Updated code for our mote stuff.

Finished.