Changed the header for the script and provided more info for Error cases