Clean up process images function.

is prettier now.