no messy code & depth search works with recursive and stack array all together