Yes, abstrancting it out sounds like a good idea. More DRY. I'll make the changes and update this PR.