parsing algorithm improvement