Slightly improved the calculation algorithm to take into account monthly caps