refactored with rspec and fixed config output