Refactor tests and add light documentation.