Refactoring of Powertypes pattern