The House of Representatives voted to pass the USA Freedom Act on Wednesday, approving a bill that would change the way the National Security Agency gathers telephone data of American citizens. The bill now heads to the Senate.

The USA Freedom Act was passed overwhelmingly with 338 votes in favor and 88 against.

Under the USA Freedom Act, the NSA would be prohibited from collecting telephone metadata under the Patriot Act. Instead, the agency would have to acquire a warrant every time it wanted to access phone records, which would be held by telephone companies.

Officials would need to submit data requests via keywords in order to collect relevant data from companies.