changed matrix from boolean to 0/1 char