can we extract this into a function? we do this alot