Combine scanning and reshuffling into one kernel