Continue refactoring tests and applying minor bug fixes.