All this code is lacking tests.