Fixed the main loop and options