Added the new versions of the request handling functions.
Fixed up several memory leaks.