Misc. bug fixes and added documentation.
Merge remote-tracking branch 'origin/master'