use template to replace space