added tree and fixed minor issues