some refactoring due to new data type BigInteger
add limits and new test for it