updated programatic approach for size of arrays