refactor separate kvpair to kvpair.go; simplify sorting interface