Refactoring schema and fixing fill of table of tree