This should be a private helper method, not a function defined within this function.