a little rewrite

First of all thanks for sharing your code. I had a thread I wanted to download and this was where I came immediately from a DDG search. I naturally tweak things, and I had a few issues with it not finding any images on the page. So I started tweaking and then.... I kind of rewrote the whole thing.

Anyways, just sharing back.

Peace