Use maps instead of large arrays in order to store counts. This helps with sparsity