replaced several fuction bodys with list comprehension syntax, found bug in inner_matrix