Contouring algorythm; not ready but partially tested