updates to the maturity logic, made the function more clear