Added more tests to test_endpoint.
Some small improvements in the other files