Modify printScripts() so scripts are returned instead of echo'd.