refactor functions
implemented limited translator for lua side