refactor: avoid repetition