javascript and carousel refactoring