Refactoring implementation target into a generic trait