Refactored lm and glm