Created main loop