Added keyboard interrupt handling