removed redundent forloop