refactoring to composite