depth limited first implementation