Changed Main Loop