small refactor to avoid duplication