improve sorting cli list, improve tests