reorganized API; fixed a bug in AST dumps; various minor fixes