Refactor to component