changed matrix stuffing to construct list of coordinates