Refined implementation as proposed by Peter.

Todo: Make a nice Demo for task 1.
added demo for marching cubes