- added PGZ functionality
- some code refactoring