Move some code around for better grouping.
Remove unused process-response function.