Fixed disconnect message
Re-organised code