Added Handling of redirect