removed goto statements from read_matrix_file