Refactored code for building images menu; not reusing the same iterator anymore (hopefully fixing a500 crash)