Refactored templates, fixed formatting