Update blog post link and make algorithm robust.