Sorting out brackets