Adding onError handling, fixes #1
Moving functions and making sure all stacks check for the method name see #2
Adding a fill fledged logging example