add switch for case-sensitive sorting, tweak package handling