Added B.disconnect(), moved disconnection handling there, also added check if a connection to the server could not be made.