Refactor redirect_to_certificate