Group some code under a load_image_to_match function.
More preparation for refactoring