Improved arrange_photos method