renamed MainLoop to Main
more polish