Finished (I think)

m has to be an array with lengh x and y values in each x
Final Version 3
Revert "Finished (I think)"

This reverts commit f53e2f3058c7a754e6264dbd7b534e3fcc7b5072.