Another try could be to combine the two functions, since their role is similar enough. But this branch isn't the right place for that work anyway. Perhaps we can revisit it once all this is said and done.