change command parsing code to iterate on arguments only twice