Bug fixes, added docs.