improve logging, including adding email logs
remove broken cors
exception handling and consistency
remove double display of errors.