Porting old code to oogl.js