Prefactoring, from TDDAYMI to imperative shell. In the next step we
need the implementation from the functional core in the imperative
shell, to pass in the environment variable.
Intermediate steps not committed - addresses_as_list, because long stack
trace in output. turned out 'nil' case needs to be explicit now. I
prefer the small functions though instead of whole implementation in
case statement.