can we turn this into a function? it gets repeated in the next method too