Main loop created