Complete overhaul to winmain