big update to tree handling.
added various migrations