Cleaned up and added glm