refactored main into hero.lua