Added logout fun with new template