refactored lua build