Added exception handling to main loop