added debugging code
added a check for signed wraparound.  Added debugging code.