Added new code for glm