implements calculation