optimized gallery rendering (broken for successive folder loading), introduced promises for switching between all and selected images