Fixes head joint clipping, moves constants, fixes compiler and runtime errors.
Adds missing constant and some comments.