More refinements to Lua binding code, some cleanup