Use ast more

Separate functions `traverse` and `findUseage`, and add some tests.