refactor from view to component