added checks for non-array term, web review also sorts data by term[0]