You have different versions of the handler that are now doing conditional statements for front/back channel logout. My thought would be to have separate handlers for each logout type, and encapsulate the logic inside each.