Refactoring for open/close principle