code for carousel.