Refactored slide.js