Refactor Tegis/Cegis