moved more functionality to lua