Update main.lua

finished all the logic and shit