add an efficient system for arithmetic
Merging in petehunt
fixing merge conflicts