Can this be refactored into a reusable component, or template?