* @param client
	 */
	private void cmd_connect(final String arg, final Client client) {
		// Trim the argument of any additional whitespace
		final String[] args = Utils.trim(arg).split(" ");

		debug("" + args.length);
		
		// if the arguments are invalid somehow, tell the user what the correct options are
		if (args.length < 1 || args.length > 2 || args[0].equals("")) {
			send("Enter a valid character creation or connection string",                                 client);
			//send("such as 'create <character name> <password>' or 'connect <character name> <password>'", client);
			//send("To connect as a guest simply type 'connect guest'",                                     client);
			//send("NOTE: Using an valid account name and password will trigger the account options menu",  client);
			return;
		}

		final String user = Utils.trim(args[0]);
		final String pass = args.length > 1 ? Utils.trim(args[1]) : " ";

		debug("Username?: " + user);
		debug("Password?: " + Utils.padRight("", '*', pass.length()));
		debug("");
		
		Player player = null;
		
		// Guest Players
		if ( user.equalsIgnoreCase("account") ) {
			setClientState(client, "account_login");
			handle_account_login(user, client);
		}
		else if ( user.equalsIgnoreCase("guest") ) {
			if (guest_users == 1) {
				player = getNextGuest();

				if (player == null) {
					// if we don't have sufficient existing guest players, make a new one
					objectDB.addAsNew( createGuestPlayer() );
				}

				init_conn(player, client, false);

				guests++;
			}
			else send("Sorry. Guest users have been disabled.", client);
		}
		else {
			/*
			 * NOTE: if all players always existed, then instead of
			 * instantiating a player i'd simply assign a client to it.
			 * Otherwise I need to get the player data from somewhere so I can
			 * load it up.
			 */

			/*
			 * I don't want account names to conflict with characters, so
			 * perhaps I will insert a stopgap measure where you must indicate
			 * an account like this:
			 * 
			 * connect account
			 * 
			 * If the user input is 'account' we will assume you want to connect
			 * to an account and will do an interactive login for you.
			 * 
			 * Other we will look for a character by the name given.
			 */

			if (use_accounts) {
				// account check
				final Account a = acctMgr.getAccount(user, pass);

				// debug("CONNECT: Fail");
				// send("That account does not exist or the password is incorrect!",
				// client);

				if (a != null) {
					if (a.getStatus() == Account.Status.ACTIVE) {
						this.caTable.put(client, a);
						account_menu(a, client);
						setClientState(client, "account_menu");
					}
					else {
						final String message = Account.msgmap.get( a.getStatus() );
						
						if( message != null ) send(message, client);
					}

					return;
				}
			}

			// character check
			// NOTE: use DB here too
			final Player p = objectDB.getPlayer(user);

			if (p == null) {
				debug("CONNECT: Fail");
				debug("No such player!");
				send("That player does not exist or the password is incorrect!", client);
				return;
			}

			if (p.getPStatus() == Player.Status.BANNED) {
				debug("CONNECT: Fail");
				debug("Player " + p.getName() + " is banned!");
				send("Player is banned.", client);
				return;
			}
			
			final String password = p.getPass();
			final String password_hash = Utils.hash(pass);

			//if ( !p.getPass().equals()) {
			if( !password.equals(password_hash) ) {
				debug("PASS: Fail");
				send("That player does not exist or the password is incorrect!", client);
				return;
			}

			debug("PASS: Pass"); // report success for password check
			
			// TODO how do I handle what amounts to a second login after some kind of pseudo-disconnect 
			
			// remove player in case of relogin (this is the not ideal handling)
			final int playerDBRef = p.getDBRef();
			final String playerName = p.getName();
			
			for (final Player player1 : this.players) {
				if ( player1.getDBRef() == playerDBRef && player1.getName().equals(playerName) ) {
					/* won't work because client object vanishes when the player loses connection */
					init_disconn(player1.getClient(), false);
					break;
				}
			}
			
			// connect to the game
			if (mode == GameMode.NORMAL) {
				init_conn(p, client, false); // Open Mode
			}
			else if (mode == GameMode.WIZARD) {
				if (p.getFlags().contains("W") || p.getAccess() == Constants.WIZARD) {
					init_conn(p, client, false); // Wizard-Only Mode
				}
				else send("Sorry, only Wizards are allowed to login at this time.", client);
			}
			else if (mode == GameMode.MAINTENANCE) {
				send("Sorry, the mud is currently in maintenance mode.", client);
			}
			else {
				send("Sorry, you cannot connect to the mud at this time. Please try again later.", client);
			}
		}