improved tests and documentation