looks we have same logic as 47-48, it would be great to extract a function for it.