Updates and tests to fix max depth issue #1