returned lua code
merged with master