WIP: Fix tests and improve coverage.