Added error handling for keyboard interrupts and other exceptions, to verify correct Host address and other changes to make code more robust