added ability to control how command names are extracted