working on slicing alg

making all the code more stable and corectly nested.
About to start working on the z1 slicing part.