refactoring to introduce decorator class