updated. using jagged arrays.