Factor out redirect logic