Refactor generation powershell to make more sense