API documentation update.

Updated API docs, incorporated fixes for the majority of Alexey's bugs.