Your error message could simply be a typo. Which error messages are you getting? Are you getting the messages when you use the script or when you try to create the script?
Error message: function not found
with Clean_Trailing highlited in the code
Did you install the custom function Clean_Trailing with it's proper parameters?
Usually it's good practice to include when a custom function calls another custom function by labeling them private and public. There's two Clean Trailing custom functions, depending on version near the bottom
I did, but it turns out i made a typo in the name of that funtion
Thanx for the tip