- added some new functions and variables
- better debug output