Updated webgl code

Added updated, optimized version of webgl code