M/nestedloop

Would also make the testing easier in this PR