Fix style errors. Replace pop with remove when shrinking the command list.