Got the script working in non-interactive mode!