don't make functions within a loop