Removing glm dependencies and overall code cleaning