Merged find_matrix and succ_generate file since they are always used in tandem