please split the "guts" out into a separate function.