clean up/reorganize search_quality() function code, add comments where helpful.
clean up/reorganize search_quality() function code, add comments where helpful.

jibsen/imgmin,rflynn/imgmin,jibsen/imgmin,rflynn/imgmin,rflynn/imgmin,jibsen/imgmin,micmro/imgmin,jibsen/imgmin,rflynn/imgmin,pornel/imgmin,micmro/imgmin,pornel/imgmin,pornel/imgmin,micmro/imgmin,pornel/imgmin,micmro/imgmin