Improve smilies scanner and put code to template file.