Added API documentation, some more API improvements I forgot to add in earlier.