got rid of for loops