refactoring slides.js