updated so it calculates the values correctly