sorting and getting labels of activities