Simplifications to code

Removed unnecessary code, references to g, simplified things in the main
code here and there, made most user-interesting variables global and
included their default values with their declarations at TOF.