 	uint winMovingIdx = 0;
 	for( uint shardIdx = 0; shardIdx < nShards; ++shardIdx ) {
 		for( uint winIdx = 0; winIdx < nShards; ++winIdx ) {
-			std::vector<shard_entry>& window = graphShards.at( shardIdx ).at( winIdx );
+			std::vector<shard_entry>& window = graphWindows.at( shardIdx * nShards + winIdx );
 			for( uint entryIdx = 0; entryIdx < window.size(); ++entryIdx ) {
 				SrcValue[ movingIdx ] = vertexValue[ window.at( entryIdx ).srcIdx ];
 				DstIndex[ movingIdx ] = window.at( entryIdx ).dstIdx;

		}
		concatenatedWindowsSizesScan[ winIdx + 1 ] = movingIdx;
	}
	graphShards.clear();

	// Define and allocate device buffers.
	device_buffer<Vertex> dev_vertexValue( nVertices );

	movingIdx = 0;
	for( uint winIdx = 0; winIdx < nShards; ++winIdx ) {
		for( uint shardIdx = 0; shardIdx < nShards; ++shardIdx ) {
			std::vector<shard_entry>& window = graphWindows.at( shardIdx * nShards + winIdx );
			uint inWinMovingIdx = 0;
			for( uint entryIdx = 0; entryIdx < window.size(); ++entryIdx ) {
				if( procesingMethod == CW ) {
