removed redundant loop