Refactoring and added echo support to the autoexec