code clean up for GLM