refactoring + new version of CID