simplify main.lua a bit