calculation cleanup
merged with Reece's changes