updated lua script functions