Fixed total price calculation and update. Also did some code tidy