remove unneeded outer loop and duplicated range steps