Test improvement and refactorings.