Bug fixes and some documentation additions