got rid of a for loop