GPU friendly version