Automatic saving on modification

Not elegant but functional. I also fixed a bug in tree population that I came across
Update the database to more closely resemble the proposed concept