refactor: avoid repetition
Merge pull request #2095 from layerssss/patch-1

refactor: avoid repetition