Update and fixed some calculations