Refactor to DRYish