VCR tests and some refactoring