Clean up division by zero errors, deal with open/short circuits.
Clean up whitespace and add vim modelines.