Working implementation for 1 shard, 1 thread