Refactoring to components