Add API docs and some cleanup