Rearranging things to make sense going forward

Bonus: struct s_edge is now a tree.