reduced use of closures and changed item script calls to close some memory leaks