use list instead of array