Some fixes again
Added custom function to template engine