Added docs, bug fixes