implement infinity scroll in gallery; unsorted -> unsolved for-each-loop problem