Finished working version with Matt McCutchen's BigInteger library, now need to substitute my own BigInteger code.