Initial work integrating glm

And removing fixed-function bits