MainLoop basic framework