does this make sense to extract to a function?