Fixed the sliding issue in carousel and cleaned te code