adding redirect handling.