added function to generate recurrent connections from BM, added test