soved the overlapping of calculations problem