Modified the gallery view implementation