readded everything from working gallery version