Add coverage, improve error handling.