did some refactorings on city_factory suggested by rubocop