Cleanups in the code and OGL fixes