Fixed bug with +/- button (issue #15)

- also rewrote the invert and lastNum functions to be more efficient
and just generally better all round