change parsing algorithm