refactoring to decorator