Added iteration, changed the BigDecimal to double