Changed routine for creation of matrix that holds all data