BigInteger refactoring