Need to check out what happens when the encoder overflows and (if this causes a problem) add a workaround.