Minor refactoring to tests