add logic for displaying thumbnails on page