Main loop added