Move last little bit of script into a function so local is available
Merge pull request #56 from erikpukinskis/master

Move last little bit of script into a function so local is available