Refactor 'flatten binary tree to linked list'.