public Message(String message) throws InvalidMessage {
		
		int prefix_end = -1;
		int trailing_start;
		String[] tmp;
		
		String trailing = null;
		
		if (message == null || message.length() < 1) {
			throw new InvalidMessage("<<empty message>>");
		}
		
		// grab the prefix
		if (message.charAt(0) == ':') {
			prefix_end = message.indexOf(" ");
			this.prefix = message.substring(1, prefix_end);
		}
		
		// grab the trail, if it exists
		trailing_start = message.indexOf(" :");
		if (trailing_start >= 0) {
			trailing = message.substring(trailing_start + 2);
		}
		else {
			trailing_start = message.length();
		}
		
		// split the command and other params
		tmp = message.substring(prefix_end + 1, trailing_start).split("\\s");
		
		// too many parameters
		if (tmp.length > 16) {
			throw new InvalidMessage("To many parameters: " + message);
		}
		
		this.command = tmp[0].toLowerCase();
		
		for (int i = 1; i < tmp.length; i++) {
			this.parameters[i - 1] = tmp[i];
		}
		
		// add trailing parameter is it exists
		if (trailing != null) {
			this.parameters[14] = trailing;
		}
		
	}