main and templates