Corrected accordion function