implemented preorder and initial tests