Minor refactoring for spec