VERY IMPORTANT CHANGES

had to use BigDecimal instead of double because of precision with
floating point numbers. now it works brilliantly!