Implemented auto reconnect and added some console output