Clean up template prior to rendering. Fixes for issue #35

This could be a larger issue than this simple fix. I'm not sure that any unicode sequence within the template will work, since they cannot be tested as the name of a javascript function. I admit, I'm still a bit lost in the final template replace regex, but that seems to be where the issue is:)