fixed some typos and changed the main function for use as .exe