removed redunandant loop