finished BBGLgenCode.js