Usage of a function in loops should be avoided