Applying template