remove irrelevant commands