factor beamer template into it's own function