Added documentation and other fixes