Progress in the meshing algorithm

Although some consultation about the helper functions needed.