Refactor.
Add code coverage and Makefile.