move calculations into nonclass functions