minor refactoring
add sorting methods which accept Comparator