Add new options: --sort and --rsort

dreisner: various cleanups mostly for style