Modified main predicates to work with multiple depth levels