NXP-14879: udpate to use list instead of arrays
NXP-14879: reformat code