Added redirect checking