works properly on multiple images