changed connectToServer() to boolean