cleanup and iv bugfix

The iv button wasn't working. Also renamed a bunch of variables to be
more consistent