gl: clean up of the code