add doco and more tests