Implemented sort and keys (lo, hi).