I'm not comfortable with this block of code being duplicated from the extremely similar one in the method below this. Can you find a way to keep this modular?