public static Message parse(String data)
	{
		int pos = 0;	//Current position in string
		int oldPos;

		String prefix = "";

		//Trim the data
		data = data.trim();

		try
		{
			//Extract prefix
			if(data.charAt(0) == ':')
			{
				//Find first space and extract until that
				pos = data.indexOf(' ') + 1;
				prefix = data.substring(1, pos - 1);

				//Suck up spaces
				while(data.charAt(pos) == ' ')
				{
					pos++;
				}
			}
		}
		catch(IndexOutOfBoundsException e)
		{
			//Invalid message
			return new Message((String) null);
		}

		//Extract command
		String command;

		oldPos = pos;
		pos = data.indexOf(' ', pos) + 1;

		if(pos == 0)
		{
			//Get till end of string
			command = data.substring(oldPos);
			pos = data.length();
		}
		else
		{
			//Get till space
			command = data.substring(oldPos, pos - 1);
		}

		//Create base message
		final Message baseMsg = new Message(command.toUpperCase(), prefix);


		//Extract parameters
		while(pos < data.length())
		{
			//Suck up spaces
			while(data.charAt(pos) == ' ')
			{
				pos++;
			}

			//Test if character is a :
			if(data.charAt(pos) == ':')
			{
				//Use all other characters as last parameter
				if(pos == (data.length() - 1))
				{
					baseMsg.appendParam("");
				}
				else
				{
					baseMsg.appendParam(data.substring(pos + 1));
				}

				break;
			}
			else
			{
				//Find next space
				oldPos = pos;
				pos = data.indexOf(' ', pos) + 1;

				//Append parameter
				if(pos == 0)
				{
					baseMsg.appendParam(data.substring(oldPos));
					break;
				}
				else
				{
					baseMsg.appendParam(data.substring(oldPos, pos - 1));
				}
			}
		}

		//Return finished message
		return baseMsg;
	}