fixes #5: tests
fixes #8: sample for customising behaviour