massive readability improvement...
For variables that i know the meaning of, I renamed them to something
useful. I also got rid of some global variables. Still more to go!