made idiomatic lua changes to local