Current state for #6. Todo is growing.
Current state ... made helper functions for puppetdb-connect and debug.
Refactoring of initialization.
Added most of the needed functionality for #6.