removing redundant commands