Modify jagged array and add print function