Adding DOM parsing algorithm