Cleaned up GLSL functions