cleanup and valgrind ok for gl part