Incremental refactor to reduce duplication