Improve iteration process over gallery pages
CC @garthwebb