The Supreme Court ruled unanimously that workers who fill orders in warehouses need not be paid for the time they spend in security lines at the end of their shifts to make sure they haven’t stolen any products.

The court reversed lower court ruling for the workers, who alleged they spent up to 25 minutes at warehouses in Nevada waiting to go through security clearance.

Justice Clarence Thomas said that federal law requires that workers be paid for activities before and after their shifts only when the activities are “integral and indispensable” to the job they are hired to perform, reported the Washington Post. 

“The Court of Appeals erred by focusing on whether an employer required a particular activity,” Thomas wrote. “The integral and indispensable test is tied to the productive work that the employee is employed to perform.”

Thomas said that Integrity Staffing Solutions, a company that provides workers for Amazon warehouses across the nation, “did not employ its workers to undergo security screenings, but to retrieve products from warehouse shelves and package those products for shipment to Amazon customers.”

The workers had claimed that because the security checks were required in order to keep their jobs, they should be compensated for their time. And they said that the company could cut the wait time by employing more security screeners or staggering shifts so that not all the workers were released at once.