flattening wip - tree correct
update tests and main.js