moved total price calculation logic