Changed redirect logic