Added signal handling and proper logging in the request handling.