More minor cleanups in main.lua