Store the frame_data structures in a tree, rather than a linked list.