Added API documentation. Overall improvements.