no more "%s" string for inserting in template.

It helps the program to handle every scenario.
written new algo in comments and prepared the template.