Started working on API docs; fixed global leak