working on checking return values
added:
- debug output, debug mode