added checks to display right accordion item