closed function and added function call to script