changing the redirect to accept an optional status code