Made script into a function
Made script into a function