several changes

- filtering out ultra-bad shapes
- more debug info
- move generator moved to a separate file