Moving template into code for frequency