better parsing algorithm.