this seems wrong. Can't you avoid the for loop?