Convert command identification from cascaded ifs to nested switches.