added basic algebra for division, simplified subtraction code, states for buttons