remove the temporary variable $req where it is underused

and use it in every place if it is already in use