Nunchuk cleanup

WIP. Trying to remove the various magic constants around in various places and make it a lot easier to read and understand. This is a first pass.