Crazy tree structure with references, mind = blown.