private void authenticate()
    {
    	boolean isValid = false;
    	String username = "";
    	
    	while (!isValid) { 
    		synchronized (currentUser.getUsers()) {
    			try {
    				msg = (Message)inFromClient.readObject();
    				username = msg.getMessage();
    				if (!msg.getType().equals("login")) {
    					isValid = true;
        				pass = false;
        				break;
    				}
    				if (!currentUser.getUsers().containsKey(username)) {
    					currentUser.setUsername(username);
    					isValid = true;
    					msg.setType("Success");
    					msg.setMessage("You are now logged in as : " + username);
    					outToClient.writeObject(msg);
    					currentUser.getUsers().put(username, currentUser);
    				} else {
    					msg.setType("Fail");
    					msg.setMessage("Username already in use");//Use error codes?
    					outToClient.writeObject(msg);
    				}
    			} catch (IOException e) {
    				isValid = true;
    				pass = false;
    			} catch (ClassNotFoundException e) {
    				isValid = true;
    				pass = false;
    			}		
			}
    	}
    }