added contains and depth first print