Should I put in another issue/PR to refactor this code to remove duplication?