Sort keys: spec and refactor #92