refactoring accordion code to make it easier to reuse for references which has very different html