Made the bulk of the program, copying it over from a PowerShell script.