I solved my problem and would like to share the solution .
Here are the substitutions and changes I made to the code to make it work perfectly.