this looks like the code from line 80. Outline in a  function?