can this block of code be a function?  prevent code duplication