Fix broken feature specs

Plus some refactoring courtesy of @jfarmer