refactored tree object and added failing test