Moved script output to functions file

Limits function re-use and puts all the parameters in once place.