Some documentation added and tests fixed.