Renamed and swapped some variables to fix inconsistencies in image_handler