Reworked Lua API and structured it better