Tidied template files - reduced switching between PHP and HTML, simplified PHP formatting a bit