Use SparseArray for better performance