Refactor to get rid of duplication smell CC picked up