Refactored some of the code in IIS_Functions.ps1