Made most of the calculations async