factor out cf and utils, fix docs