Fix issues in horton-esp-gen.py
Improved output code for scripts
Eliminate duplicate code