spread some complexity around, move some complex logic to its own method