Patch it all into a main function

That's what MS Windows likes