Added sorting to crop_images method