DRY-up code, move to static helpers