Make depth configurable and fix tests (fixes #2)