I mean, this function is not useful for other methods, this is why I used nested function, but I understand the performace issue.