refactor in prep for generating c