Finalize the script?

I think the script is ready to go. I guess it's time to start
generating some image maps from it.
Added some comments

Somehow I doubt my code is clear enough to just read with no
comments.