modulate fetch_image

main() was getting too big.
simply move some code out