Is there not a built in method that does this?
Why are you reparsing their html?