For better performance, changed most List<int> to Int32List.