removed M=Matrix() and changed indentation