Restructure cmds structure to be sortable

The structure should be sortable at run time so that they needn't be sorted
in the source code (although this could be fixed by an AWK command in the
build process later). Also fix the binary search algorithm so it actually
works.