public HtmlToken next() throws IOException, MalformedHtmlException {
		if(!queue.isEmpty()){
			//We still have HtmlTokens to emit
			return queue.remove();
		}else if(!end){
			//We need new HtmlTokens
			tokenize();
			if(!queue.isEmpty()){
				//We have new HtmlTokens to emit
				return queue.remove();
			}else{
				//We've reached the end
				return HtmlEofToken.EOF;
			}
		}else{
			//We've reached the end
			return HtmlEofToken.EOF;
		}
		/* OLD hasNext() code
		if(!hasNext()){
			return HtmlEofToken.EOF;
		}else{
			if (!end) tokenize();
			assert !queue.isEmpty() : "ERROR: #hasNext() returned true yet there is NOTHING in the queue!";
			return queue.remove();
		}
		*/
	}