Added KeyboardInterrupt catch