Move component function to components.js