feat(library): allow custom listeners

fix #35
fix(library): replace null pointers with Option<>
Merge pull request #37 from passy/pr36-fix

Pr36 fix