more calculation updates
merge with brian's work