Improving

I corrected the algo to not repeat the same calc