Extract GradientCodeGenerator into it's own file

* Move things around to reduce files and clean up organization