Duplicate request handling, improved.
Cleaned up the wrapper functions and improved error reporting.