Adding coverage support.
A bit of refactoring.