Added depth argument

Currently only works with circular == false, but there won't be many use cases where circular == true and depth < Infinity.