Refactor: remove duplication