Refactored inorder for tractable solution