Cleaned up the api and the AST code