munged all calculations into one api method