Updating layout for gallery