sort out  redirect codes