move the initial code fetch into here