Reformat lua
Little bit of refactoring