Rewrote the part that switches between slides