sorting and testing