refactor to generate the ul list for the dropdown more dynamic