Refactor gl init