Use tree rather than commit, and tidy up a bit