Refactoring KifFormat hack so that it is less of a hack.