lua part refactoring