variable name cleanup
cleanups. guard against division by zero
reworked datastructures