Unit tests, refactoring, and code cleanup for WordDao.