updated mainGL to use class factories