add retreat handler (not finished)