Refactor tests and prepare integration.