Moved setting variables outside of main so they are global and added some documentation to them