Started working on tree logic