Removes some extra copies for debugging
Fixes errors, improved algorithm, good output (eps/png)