Neatened lots of code, and converted many mechanics over to the new
system.