Refactor lua module.