a better solution: in order traversal