moved gallery code into its own snippet