Algorithm to show pictures, picture detail view