updated it for default redirect and more security