Refactor duplication