Move function to a component