Fixed some bugs.
Added API documentation (not yet complete).  Corrected a bunch of bugs.