Cf directory updates

mostly dialyzer-related fixes and some refactoring of duplicated code.