refactor into components