Refactored request handling.