made the user redirect function far more flexible