Added Parameters and a Function

Made the script easier to use with a function and parameters.