Refactored templates into component