Better to use `vapply()` here and should be pulled out into own function.