Improved powershell script