Cleaned up makevarsfile.py

Added comments, and reworked (streamlined) how the script worked in
certain areas.