returned main calculation