simplify cat-file
read and write trees
small refactor