small refactor to DRY