compacted list and extract commands into one