made all needed functions in lua file