Remove function from loop