Add more tests and improve docs