Small refactoring. Lua implementation progress.